﻿using BasicInformationWrite.API.BasicInformationCommons.Departes;
using ERPSystem.Common.Domains.Department;
using ERPSystem.Common.DTO;
using ERPSystem.Enum.CommonErrorCodes;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicInformationWrite.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DepartsController : ControllerBase
    {
        private readonly IMediator _mediator;

        public DepartsController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 部门添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> DepartCreate(DepartCreateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
    }
}
